use std::fs::{self, File};
use std::path::{self, Path, PathBuf};
+use semver::VersionReq;
use tar::Archive;
use flate2::{GzBuilder, Compression};
use flate2::read::GzDecoder;
use core::{SourceId, Package, PackageId};
+use core::dependency::Kind;
use sources::PathSource;
use util::{self, CargoResult, human, internal, ChainError, Config};
use ops;
try!(check_metadata(&pkg, config));
}
+ try!(check_dependencies(&pkg, config));
+
if list {
let root = pkg.root();
let mut list: Vec<_> = try!(src.list_files(&pkg)).iter().map(|file| {
Ok(())
}
+// Warn about wildcard deps which will soon be prohibited on crates.io
+#[allow(deprecated)] // connect => join in 1.3
+fn check_dependencies(pkg: &Package, config: &Config) -> CargoResult<()> {
+ let wildcard = VersionReq::parse("*").unwrap();
+
+ let mut wildcard_deps = vec![];
+ for dep in pkg.dependencies() {
+ if dep.kind() != Kind::Development && dep.version_req() == &wildcard {
+ wildcard_deps.push(dep.name());
+ }
+ }
+
+ if !wildcard_deps.is_empty() {
+ let deps = wildcard_deps.connect(", ");
+ try!(config.shell().warn(
+ "warning: some dependencies have wildcard (\"*\") version constraints. \
+ On December 11th, 2015, crates.io will begin rejecting packages with \
+ wildcard dependency constraints. See \
+ http://doc.crates.io/crates-io.html#using-crates.io-based-crates \
+ for information on version constraints."));
+ try!(config.shell().warn(
+ &format!("dependencies for these crates have wildcard constraints: {}", deps)));
+ }
+ Ok(())
+}
+
fn tar(pkg: &Package, src: &PathSource, config: &Config,
dst: &Path) -> CargoResult<()> {